跳到主要内容

GetRange

Returns a Range object that represents the part of the document contained in the specified table.

Syntax

expression.GetRange(Start, End);

expression - A variable that represents a ApiTable class.

Parameters

NameRequired/OptionalData typeDefaultDescription
StartRequiredNumberStart position index in the current element.
EndRequiredNumberEnd position index in the current element.

Returns

ApiRange

Example

This example shows how to get a Range object that represents the part of the document contained in the specified table.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
doc.Push(table);
table.GetCell(0, 0).GetContent().GetElement(0).AddText("This is just a sample text.");
let range = table.GetRange(0, 3);
range.SetBold(true);